﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace 泛型集合List
{
	class Program
	{
		static void Main(string[] args)
		{
			//创建泛型集合对象
			List<int> list = new List<int>();
			list.Add(1);
			list.Add(2);
			list.AddRange(new int[] { 1, 3, 7, 8 });
			list.AddRange(list);

			//List泛型可以转换为数组(取决于集合类型)
			int[] nums = list.ToArray();
			List<int> lists = nums.ToList();

			foreach (var item in list)
			{
				Console.WriteLine(item);
			}

		}
	}
}
